//
//  AMNavigationViewController.m
//  AMwb
//
//  Created by zhc on 15/11/28.
//  Copyright © 2015年 zhc. All rights reserved.
//

#import "AMNavigationViewController.h"
#import "AMhomeTableViewController.h"


@interface AMNavigationViewController ()

@end

@implementation AMNavigationViewController

+(void)initialize{
   
  UIBarButtonItem *item=[UIBarButtonItem appearance];
    
    
    NSMutableDictionary *textAttrs=[NSMutableDictionary dictionary];//创建可变字典
    textAttrs[NSForegroundColorAttributeName]= [UIColor blueColor];//字体颜色
    textAttrs[NSFontAttributeName]=[UIFont systemFontOfSize:13];//大小
    
    [item setTitleTextAttributes:textAttrs forState:UIControlStateNormal];//样式一
    
    
    NSMutableDictionary *textAttrs1=[NSMutableDictionary dictionary];
    textAttrs1[NSForegroundColorAttributeName]= [UIColor colorWithRed:0.6 green:0.6 blue:0.6 alpha:0.7];
    textAttrs1[NSFontAttributeName]=[UIFont systemFontOfSize:16];
    
    [item setTitleTextAttributes:textAttrs1 forState:UIControlStateDisabled];//样式二

}



- (void)viewDidLoad {
    [super viewDidLoad];
    


}
//拦截控制器的操作，统一实现一些功能

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    
    
    if(self.viewControllers.count>0){
     viewController.navigationItem.leftBarButtonItem=[UIBarButtonItem itemWithtager:self image:@"navigationbar_back" imageHighlighted:@"navigationbar_back_Highlighted" action:@selector(backTo)];
       
        viewController.navigationItem.rightBarButtonItem=[UIBarButtonItem itemWithtager:self image:@"navigationbar_more" imageHighlighted:@"navigationbar_more_Highlighted" action:@selector(toRoot)];
        
                                                         
   }
    
    [super pushViewController:viewController animated:YES];

     // NSLog(@"%d",self.viewControllers.count);

}

- (void)toRoot{
   //回到根控制器
    [self popToRootViewControllerAnimated:YES];

}

-(void)backTo{
  
    [self popViewControllerAnimated:YES];

}




@end
